package com.zero.lite.admin.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;


/**
 * Created by zengzr on 2018/4/23.
 */
@Controller
public class MessageController {

    @Autowired
    private SimpMessagingTemplate simpMessagingTemplate;

    @MessageMapping("/chat")
    public void handelChat(String from,String to,String content){
        simpMessagingTemplate.convertAndSendToUser(to,"/queue/chat",content);
    }
}
